//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.zbs.framework.start.entity.tree;

import com.zbs.framework.common.utils.ErrEnum;

public class ResultUtil {
    public ResultUtil() {
    }

    public static ResultData ok() {
        return ResultData.build().code(ErrEnum.SUCCESS.getErrCode()).message(ErrEnum.SUCCESS.getErrMsg()).data("");
    }

    public static ResultData ok(Object data) {
        return data instanceof ResultData ? ok(data) : ResultData.build().code(ErrEnum.SUCCESS.getErrCode()).data(data).message(ErrEnum.SUCCESS.getErrMsg());
    }

    public static ResultData ok(ResultData data) {
        return ResultData.build().code(ErrEnum.SUCCESS.getErrCode()).data(data.getData()).message(ErrEnum.SUCCESS.getErrMsg()).total(data.getTotal());
    }

    public static ResultData error(ErrEnum errEnum) {
        return ResultData.build().code(errEnum.getErrCode()).message(errEnum.getErrMsg()).data("");
    }

    public static ResultData error(String msg) {
        return ResultData.build().code(403).message(msg).data("");
    }

    public static ResultData error() {
        return ResultData.build().code(ErrEnum.SYS_ERR.getErrCode()).message(ErrEnum.SYS_ERR.getErrMsg());
    }
}
